-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust-analyzer.toml tracking #16254
rust-analyzer.toml tracking #16254
Conversation
.rust-analyzer.toml
tracking PR.rust-analyzer.toml
tracking
f11b0da
to
2bad5e7
Compare
@rustbot author |
In order to achieve this, I had to virtually rewrite ConfigData's default values to their typed versions. It ended up looking not so well. I will think of something to fix this. In addition to this, some default value have been hastily modified but config manual generation will be a stay as a reminder to fix this.
2127e06
to
4196ad5
Compare
I kept going on config.rs. alibektas#1 targets this PR branch. |
See alibektas#2 for inheritable config, and alibektas#3 for a silly implementation of actually inheriting in a tree shape. What libraries like figment/config won't do is update when files change on disk. I also believe the plan is for the configuration to auto-update simply because the files are in the Vfs and get watched, so we do need a way to incrementally update the config. (My silly implementation should have just used salsa for that, but did not.) There is also a lot of custom-ness (aliases, tables to underscores, schema generation, ...) baked onto the json and by extension toml deserializers.
Agree, because the one in XDG_CONFIG_HOME will do the job of setting defaults, and does it way better. It will apply to all editors, for example. That leaves a natural job for client configs to override per-editor. So once this stuff lands most people can move what's in their init.lua/vscode config to XDG at their leisure, and eventually only use the client config for client-specific things like "don't insert close parens". No rush, no breaking changes.
That's what I had in mind. |
Oh duh, you're absolutely right. I didn't consider that those files would change over time!
Glad to hear it! |
… roots Also renames a bunch of functions and hides PointerCmp from public API
Option<T> version of all the *ConfigDatas, named *ConfigInput
👋 Sorry for being inactive for the last couple of days. There are certain issues that I want to draw your attention to
|
Config tree
No worries, sorry for the delay in repsonding!
I'm not sure that conversions after the fact are strictly necessary—I haven't thought about this enough, sorry!—but it seems like |
Oh I forgot to write my follow up comment. Current strategy is the following and this makes my previous comment kinda obsolete.
I think in 2-3 weeks we will have a prototype ready. The most complex example I have been thinking of testing my approach with is a scenario with linked projects and I gotta be honest. I have never dealt with |
To confirm my understanding: that separate database will have
Nothing at this time, but I'll give it a spin when it's ready! |
Here you can see how far we have gotten with our planned
.rust-analyer.toml
( akaRATOML
configuration file ). The related issue is #13529. Our roadmap is roughly : ( this is a modified version of this comment.Phase 1 :
Replace rust_analyzer::config::ConfigData with GlobalConfigData LocalConfigData. As a result of this change rust_analyzer::config::Config's data will be of type GlobalConfigData.
Integrating a deserializer : For this issue, we will use the simplest possible. When Taplo Integration Tracking #15908 becomes available we can migrate to it and start showing errors and auto-completion to the user. Many thanks to @cormacrelf for taking my ugly work and making wonders out of it!
project-model and all that lsp stuff : How do we get notified when a
toml
file get changed? How do we map a file to its corresponding RATOML file?Client settings and RATOML : During first handshakes between the server and the client config data are sent from the client to the server, which is how we have received configuration data so far. I plan to keep this as is and let server do a fresh start if any RATOML files are discovered. But this shouldn't tell you that the configs sent from the client have a higher priority than RATOML. Although I agree with Veykril on the point that our hand is forced to choose either RATOML or client settings over another, the user should still be able to say that they want to use their own configs, which means that we need to add a KV pair that does just that : telling us which source we should prefer.
First version of the RATOML : Although I may have sounded like this is something I want to have ready in the first version, I think we should first enable the use of a single RATOML file and gradually introduce nesting. So this version will use two sources to read configs from : (1) lsp_types::InitializeParams as sent by the client (2) RATOML.
Phase 2 :